#ifndef NODE_H
#define NODE_H

#include <QList>
#include <QDebug>
#include "abstractnode.h"

class Node : public AbstractNode
{
public:
    Node(){}
    virtual ~Node()
    {
        for(int i=0; i<under.size(); i++)
        {
            delete(under[i]);
        }
    }

    virtual bool isCell()
    {
        return(false);
    }

    inline void setUnder(QList<AbstractNode*> list)
    {
        under = list;
    }

    inline void replace(int id, AbstractNode *node)
    {
        under[id] = node;
    }

    inline int insert(AbstractNode *node)
    {
        under.append(node);
        return(under.size() - 1);
    }

    virtual void print()
    {
        for(int i=0; i<under.size(); i++)
        {
            under[i]->print();
        }
    }

private:
    QList<AbstractNode*> under;
};

#endif // NODE_H
